<template>
	<view>
		<block>
			<view class="ful">
				<view class="ful_left">
					工单编号
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					提报人
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					提报时间
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					所在位置
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					设备设施名称
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					设备设施编号
				</view>
				<view class="ful_right">

				</view>
			</view>
		</block>
		<block>
			<view class="ful">
				<view class="ful_left">
					设备设施名称
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					设备设施编号
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					所在位置
				</view>
				<view class="ful_right">

				</view>
			</view>
		</block>
		<view class="check">
			<view class="check_title">
				<image src="/static/icon/icon1.png" alt="">
					<text>检查项</text>
			</view>
			<view class="check_type1">
				<view class="">
					外观/组件完好无损
				</view>
				<view class="">
					<image @tap="choiceAppearance(index)" :src="item" alt="" v-for="(item,index) in appearance"
						:key="index">
				</view>
			</view>
			<view class="check_type1">
				<view class="">
					工作状态/启闭灵活
				</view>
				<view class="">
					<image @tap="choiceWorkStatus(index)" :src="item" alt="" v-for="(item,index) in workStatus"
						:key="index">
				</view>
			</view>
		</view>
		<view class="check">
			<view class="check_title">
				<image src="/static/icon/icon1.png" alt="">
					<text>检测项</text>
			</view>
			<view class="check_type1">
				<view class="">
					工作状态/启闭灵活
				</view>
				<view class="">
					<image @tap="choiceTesting(index)" :src="item" alt="" v-for="(item,index) in testing" :key="index">
				</view>
			</view>
		</view>
		<block>
			<view class="ful">
				<view class="ful_left">
					描述
				</view>
				<view class="ful_right">

				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					图片
				</view>
				<view class="ful_right">

				</view>
			</view>
		</block>
		<block>
			<view class="ful">
				<view class="ful_left">
					备注
				</view>
				<view class="ful_right">
					<input type="text" value="" placeholder="输入备注内容（非必填）" />
				</view>
			</view>
			<view class="ful">
				<view class="ful_left">
					处理方式
				</view>
				<view class="ful_right row a-center">
					<view class="ful_radio  row a-center ml-4" @tap="choiceRadio(index)"
						v-for="(item,index)  in  radioStatus" :key='index'>
						<image :src="item.icon" mode=""></image>
						<text>{{item.title}}</text>
					</view>
				</view>
			</view>
			<view class="upImg">
				<view class="upImg_title">
					上传图片({{upimages.length}}-3张）
				</view>
				<view class="upImg_files" @tap="upImgs">
					选择文件+
				</view>
			</view>
			<image :src="item" mode="" v-for="(item,index) in upimages" :key='index'></image>
		</block>
	</view>
</template>

<script>
	export default {
		name: "top_detail",
		data() {
			return {
				//检查项  外观
				appearance: [
					'/static/icon/ok.png',
					'/static/icon/err.png',
				],
				//检查项  外观 选择的项
				appearanceNum: null,
				//检查项  工作状态
				workStatus: [
					'/static/icon/ok.png',
					'/static/icon/err.png',
				],
				//检查项  工作状态 选择的项
				workStatusNum: null,
				//检测项 外观
				testing: [
					'/static/icon/ok.png',
					'/static/icon/err.png',
				],
				//检测项  工作状态 选择的项
				testingStatusNum: null,
				//处理方式
				radioStatus: [{
					title: '现场处理',
					icon: '/static/icon/icon7.png'
				}, {
					title: '上报工单',
					icon: '/static/icon/icon7.png'
				}, ],
				//处理方式选择的项
				radioStatusNum: null,
				//上传图片
				upimages: []
			};
		},
		methods: {
			//图片上传
			 upImgs() {
				uni.chooseImage({
					count: 3,
					success: (res) => {
						if(res.tempFilePaths.length+this.upimages.length>3){
							uni.showToast({
								icon:'none',
								duration:1500,
								title:'最多只能上传3张图片哦！'
							})
						}else{
						this.upimages=this.upimages.concat(res.tempFilePaths)
						}
					},
					fail: (err) => {
						uni.showToast({
							title: '图片上传失败，请重试',
							icon: 'none',
							duration: 1500
						})
					}
				})
			},
			//处理方式
			choiceRadio(i) {
				this.radioStatusNum = i
				if (i == 0) {
					this.radioStatus[i].icon = '/static/icon/icon7ed.png'
					this.radioStatus[i + 1].icon = '/static/icon/icon7.png'
				} else {
					this.radioStatus[i].icon = '/static/icon/icon7ed.png'
					this.radioStatus[i - 1].icon = '/static/icon/icon7.png'
				}
			},
			//检查项  外观
			choiceAppearance(i) {
				this.appearanceNum = i
				if (i == 0) {
					this.appearance.splice(i, 1, '/static/icon/oked.png')
					this.appearance.splice(i + 1, 1, '/static/icon/err.png')
				} else {
					this.appearance.splice(i, 1, '/static/icon/erred.png')
					this.appearance.splice(i - 1, 1, '/static/icon/ok.png')
				}
			},
			//检查项  工作状态
			choiceWorkStatus(i) {
				this.workStatusNum = i
				if (i == 0) {
					this.workStatus.splice(i, 1, '/static/icon/oked.png')
					this.workStatus.splice(i + 1, 1, '/static/icon/err.png')
				} else {
					this.workStatus.splice(i, 1, '/static/icon/erred.png')
					this.workStatus.splice(i - 1, 1, '/static/icon/ok.png')
				}
			},
			//检测项  工作状态
			choiceTesting(i) {
				this.testingStatusNum = i
				if (i == 0) {
					this.testing.splice(i, 1, '/static/icon/oked.png')
					this.testing.splice(i + 1, 1, '/static/icon/err.png')
				} else {
					this.testing.splice(i, 1, '/static/icon/erred.png')
					this.testing.splice(i - 1, 1, '/static/icon/ok.png')
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.upImg_files {
		border-radius: 10rpx;
		border: 2rpx solid #B6B6B6;
		color: #B6B6B6;
		padding: 10rpx 20rpx;
	}

	.upImg_title {
		color: #7F8084;
	}

	.upImg {
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		line-height: 40rpx;
		display: flex;
		align-items: center;
		margin: 36rpx 0;
	}

	.ful_radio {
		image {
			width: 32rpx;
			height: 32rpx;
			margin-right: 10rpx;
		}
	}

	.check {
		padding: 30rpx 0;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #7F8084;
		line-height: 40rpx;
		border-bottom: 2rpx solid #EFEFEF;

		.check_title {
			image {
				width: 20rpx;
				height: 28rpx;
				vertical-align: inherit;
				margin-right: 10rpx;
			}
		}

		.check_type1 {
			margin-left: 30rpx;
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;

			image {
				width: 32rpx;
				height: 32rpx;
				margin: 0 20rpx;
			}
		}
	}

	.ful {
		padding: 30rpx 0;
		box-sizing: border-box;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		line-height: 40rpx;
		border-bottom: 2rpx solid #EFEFEF;
		display: flex;
		justify-content: space-between;

		.ful_left {
			color: #7F8084;
		}

		.ful_right {
			color: #474747;
		}
	}
</style>
